package br.ufpe.abaco.ParserGen.lexer;

public class Tests extends Exception {



    static LexicalProcessor p = new LexicalProcessor();





    /**

     *  Constructor for the Tests object

     */

    public Tests() { }





    /**

     *  A unit test for JUnit

     *

     *@param  input                      Description of the Parameter

     *@return                            Description of the Return Value

     *@exception  LexicalErrorException  Description of the Exception

     */

/*    public static Lexeme[] test1(String input) throws LexicalErrorException {



        //espaco em branco => [' ']+

        RegExp white = RegExp.sequence(RegExp.oneMany(RegExp.charExp(' ')), RegExp.produce(-1));

        //RegExp white = RegExp.charExp(' ');

        //if

        RegExp ifExp = RegExp.sequence(RegExp.string("if"), RegExp.produce(1));

        //then

        RegExp thenExp = RegExp.sequence(RegExp.string("then"), RegExp.produce(2));

        //else

        RegExp elseExp = RegExp.sequence(RegExp.string("else"), RegExp.produce(3));

        // relop => < | <= | = | <> | > | >=

        RegExp lt = RegExp.sequence(RegExp.string("<"), RegExp.produce(4));

        RegExp leq = RegExp.sequence(RegExp.string("<="), RegExp.produce(5));

        RegExp eq = RegExp.sequence(RegExp.string("="), RegExp.produce(6));

        RegExp dif = RegExp.sequence(RegExp.string("<>"), RegExp.produce(7));

        RegExp gt = RegExp.sequence(RegExp.string(">"), RegExp.produce(8));

        RegExp geq = RegExp.sequence(RegExp.string(">="), RegExp.produce(9));



        //letter => [a-zA-z]

        RegExp az = RegExp.charExp('a', 'z');

        RegExp AZ = RegExp.charExp('A', 'Z');

        RegExp letter = RegExp.sequence(RegExp.choice(az, AZ), RegExp.produce(10));



        //digit => [0-9]

        RegExp digit = RegExp.sequence(RegExp.charExp('0', '9'), RegExp.produce(11));



        //num => digit + (.digit + )? (E (+|-) ? digit +) ?

        RegExp num = RegExp.sequence(

                RegExp.oneMany(digit),

                RegExp.zeroOne(RegExp.sequence(RegExp.charExp('.'),

                RegExp.oneMany(digit))),

                RegExp.zeroOne(

                RegExp.sequence(RegExp.charExp('E'),

                RegExp.zeroOne(RegExp.choice(

                RegExp.charExp('+'),

                RegExp.charExp('-')

                )

                ),

                RegExp.zeroMany(digit))

                )

                , RegExp.produce(12));

        //id => letter (letter | digit) *

        RegExp id = RegExp.sequence(letter, RegExp.choice(letter, digit), RegExp.produce(13));



        BNFGrammar grammar = new BNFGrammar();

        TerminalSymbol[] symbols = {grammar.getTerminal("WHITE", white),

                grammar.getTerminal("IF", ifExp),

                grammar.getTerminal("THEN", thenExp),

                grammar.getTerminal("ELSE", elseExp),

                grammar.getTerminal("LT", lt),

                grammar.getTerminal("LEQ", leq),

                grammar.getTerminal("EQ", eq),

                grammar.getTerminal("DIF", dif),

                grammar.getTerminal("GT", gt),

                grammar.getTerminal("GEQ", geq),

                grammar.getTerminal("LETTER", letter),

                grammar.getTerminal("DIGIT", digit),

                grammar.getTerminal("NUMBER", num),

                grammar.getTerminal("ID", id)};



//        return new LexerFacade(symbols).analyse(input);
            return null;


    }*/





    /**

     *  The main program for the Tests class

     *

     *@param  args  The command line arguments

     */

/*    public static void main(String[] args) {

        try {

            String t1 = "if teste then y =  19.984E-77 else y = 0";

            Lexeme[] r = test1(t1);

            int i = 0;



            while (i < r.length && r[i] != null) {

                System.out.println(r[i++]);

            }

        } catch (LexicalErrorException ex) {

            System.out.println(ex.getMessage());

        }

    }*/

}

